package com.csj.DesignPattern.template;

public abstract class AbstractClass {

    public final void cookProcess() {
        pourOil();
        heatOil();
        //！！！！！调用了抽象方法，抽象方法的实现交给字类来确定
        pourVegetable();
        pourSauce();
        fry();
    }
    public void pourOil() {
        System.out.println("倒油");
    }

    public void heatOil() {
        System.out.println("热油");
    }

    public abstract void pourVegetable();

    public abstract void pourSauce();

    public void fry() {
        System.out.println("翻炒");
    }
}
/*
public abstract class InputStream {

    //抽象方法，要求字类重写，类似于pourVegetable()和pourSauce()
    public abstract int read();

    public int read(byte b[]) {
        return read(b, 0, b.length);
    }

    //模板方法，相当于cookProcess()，定义了里面的算法步骤
    public int read(byte b[], int off, int len) {
        Objects.checkFromIndexSize(off, len, b.length);
        if (len == 0) {
            return 0;
        }

        int c = read();


        if (c == -1) {
            return -1;
        }
        b[off] = (byte)c;

        int i = 1;
        try {
            for (; i < len ; i++) {
                c = read();
                if (c == -1) {
                    break;
                }
                b[off + i] = (byte)c;
            }
        } catch (IOException ee) {
        }
        return i;
    }

}


 */